<?php

declare(strict_types=1);

namespace Plugin\Attractions\AttractionManagement\Model;

use Hyperf\DbConnection\Model\Model as MineModel;

/**
 * @property int $id 主键
 * @property string $name 景区名称
 * @property string $intro_title 景区介绍标题
 * @property string $intro 景区介绍
 * @property string $cover_id 封面
 * @property integer $status 状态
 * @property string $address 地址
 * @property string $phone 电话
 * @property string $open_time 开放时间
 * @property string $close_time 关闭时间
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 */
class Attraction extends MineModel
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'attraction';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['name', 'intro_title', 'intro', 'cover_id', 'status', 'address', 'phone', 'open_time', 'close_time'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'cover_id' => 'string', 'status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function  spot() {
        return $this->hasMany(AttractionSpot::class, 'attraction_id', 'id');
    }
}